package com.wenhai.regex.assertion;

/**
 * 断言：单词边界 Boundary \b
 *
 * @author wenhai
 * @date 2020/7/14
 */
public class WordBoundary {
    public static void main(String[] args) {
        String st = "tom tomorrow";
        System.out.println(st.replaceAll("tom", "含有替换"));
        System.out.println(st.replaceAll("tom\\b", "结尾替换"));
        System.out.println(st.replaceAll("\\btom", "开头替换"));
        System.out.println(st.replaceAll("\\btom\\b", "精确替换"));
    }
}
